package com.lagou.edu.controller;

import com.lagou.edu.service.CodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("code")
public class CodeController {
    @Autowired
    private CodeService codeService;


    @GetMapping("create/{email}")
    public Boolean createCode(@PathVariable("email") String email) {
        return codeService.getCode(email);
    }

    @GetMapping("/validate/{email}/{code}")
    public Integer validateCode(@PathVariable("email") String email, @PathVariable("code") String code) {
        return codeService.validateCode(email, code);
    }

}
